package com.hjj.springboot.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单主表
 */
@TableName("t_order")
@Data
public class Order {

    @ExcelProperty("订单编号")
    @ColumnWidth(20)
    private Integer id; // 编号

    @ExcelProperty("订单号")
    @ColumnWidth(30)
    private String orderNo; // 订单号

    @ExcelProperty("微信用户OpenId")
    @ColumnWidth(30)
    private String userId; // openId微信用户ID

    @ExcelIgnore
    @TableField(select = false)
    private WxUserInfo wxUserInfo; // 微信用户

    @ExcelProperty("商品总价")
    @ColumnWidth(20)
    private BigDecimal totalPrice; // 总价

    @ExcelProperty("收货地址")
    @ColumnWidth(60)
    private String address; // 收货地址

    @ExcelProperty("收货人")
    @ColumnWidth(20)
    private String consignee; // 收货人

    @ExcelProperty("联系电话")
    @ColumnWidth(20)
    private String telNumber; // 联系电话

    @ExcelProperty("骑手ID")
    @ColumnWidth(20)
    private Integer riderId; // 骑手ID

    @ExcelIgnore
    @TableField(select = false)
    private Rider rider; // 骑手

    @ExcelProperty("下单时间")
    @ColumnWidth(20)
    @JsonSerialize(using=CustomDateTimeSerializer.class)
    private Date createDate; // 订单创建日期

    @ExcelProperty("支付时间")
    @ColumnWidth(20)
    @JsonSerialize(using=CustomDateTimeSerializer.class)
    private Date payDate; // 订单支付日期

    @ExcelProperty("订单状态")
    @ColumnWidth(20)
    private Integer status=1; // 订单状态 1 未支付 2 已经支付/待收货 3 退款/退货

    @ExcelIgnore
    @TableField(select = false,exist = false)
    private OrderDetail[] goods; // 订单商品详情

}

